<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>挂号列表</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">
    <style>
        .mt-2 { margin-top: 0.5rem; }
    </style>
</head>
<body>
<div class="container mt-4">
    <h2>在线挂号表</h2>
    <div class="mb-3">
        <a class="btn btn-primary" href="/reg/addForm">新增</a>
        <a class="btn btn-secondary" href="/">返回首页</a>
    </div>
    <table class="table table-bordered table-striped">
        <thead>
        <tr>
            <th>ID</th>
            <th>姓名</th>
            <th>手机号</th>
            <th>科室名称</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="r : ${regs}">
            <td th:text="${r.id}"></td>
            <td th:text="${r.Name}"></td>
            <td th:text="${r.Tel}"></td>
            <td th:text="${departNameMap[r.DepartID]}"></td>
            <td>
                <a class="btn btn-sm btn-info" th:href="@{'/reg/editForm/' + ${r.id}}">编辑</a>
                <form th:action="@{'/reg/delete/' + ${r.id}}" method="post" style="display:inline-block;">
                    <button type="submit" class="btn btn-sm btn-danger mt-2" onclick="return confirm('确认删除?')">删除</button>
                </form>
            </td>
        </tr>
        </tbody>
    </table>
</div>
</body>
</html>


